/**
 * Definition for singly-linked list.
 * type ListNode struct {
 *     Val int
 *     Next *ListNode
 * }
 */
func reverseList(head *ListNode) *ListNode {
    var preNode *ListNode = nil
    currNode := head
    var tem *ListNode
    for currNode != nil {
        tem = currNode.Next
        currNode.Next = preNode
        preNode = currNode
        currNode = tem
    }
    return preNode
}